---
--类名: Area.lua
--创建日期: 2015-5-4
--创建人: 陈小虎
--功能描述: Area区域npc模型
--修改内容：
--修改日期:   
--修改人:     
--修改备注: 
--
local Vector = require("app.utils.Vector")

local Area = class("Area")

function Area:ctor(npcId, npcUid)
	self.mEventsVec = Vector.new()
	self.mId = npcId
    self.mUid = npcUid

	self.mPlayingEvents = false

	local npcConfig = GD:queryMapNpc(npcId)
    local nx = tonumber(npcConfig.coordinate)
    local radius = tonumber(npcConfig.talkRadius)
	self:setCenterX(nx)
    self._radius = radius

    self:setPublic(true)

    self:setShowMinTaskId(0)
end

function Area:isArea()
    return true
end

function Area:setTaskId(taskId)
    self._taskId = taskId
end

function Area:getTaskId()
    return self._taskId
end

function Area:setPublic(isPublic)
    self.mPublic = isPublic
end

function Area:isPublic()
    return self.mPublic
end

function Area:setBattleOrder(order)
    self._battleOrder = order
end

function Area:getBattleOrder()
    return self._battleOrder
end

function Area:setVariety(variety)
    self._variety = variety
end

function Area:isDungeon()
    return self._variety == Enums.NpcVariety.dungeon
end

function Area:setShowMinTaskId(minTaskId)
    self.mShowMinTaskId = minTaskId
end

function Area:getShowMinTaskId()
    return self.mShowMinTaskId
end

function Area:setUid(uid)
    self.mUid = uid
end

function Area:getUid()
    return self.mUid
end

function Area:getId()
    return self.mId
end

function Area:setName(name)
    self.mName = name
end

function Area:setCenterX(x)
	self.mCenterX = x
end

function Area:getCenterX()
	return self.mCenterX
end

function Area:getMinX()
    return self.mCenterX - self._radius-- - 5
end

function Area:getMaxX()
    return self.mCenterX + self._radius-- + 5
end


function Area:playingEvents(play)
	self.mPlayingEvents = play
end

function Area:isPlayingEvents()
	return self.mPlayingEvents
end

function Area:playingDungeonEvents(play)
    self._playingDungeonEvents = play
end

function Area:isPlayingDungeonEvents()
    return self._playingDungeonEvents
end

function Area:addEvents(eventsVec)
    self.mEventsVec:add(eventsVec)
end

function Area:addEventsAt(index,eventsVec)
    self.mEventsVec:setElementAt(eventsVec,index)
end

function Area:getEventsFrom(index)
    if self.mEventsVec:size() >= 1 then
        return self.mEventsVec:get(index)
    end
    return nil
end

function Area:removeEventsFirstElement()
    if self.mEventsVec:size() >= 1 then
        self.mEventsVec:removeAt(1)
    end
end

function Area:clearEvents()
    self.mEventsVec:clear()
end

return Area


